home *** CD-ROM | disk | FTP | other *** search
- Path: news1.halcyon.com!chinook!jars
- From: jars@chinook.halcyon.com (Juan Rodriguez)
- Newsgroups: comp.lang.c++
- Subject: Re: Visual C++ 4.0 DLL's for Win95 and Visual Basic 4.0
- Date: 6 Feb 1996 23:00:06 GMT
- Organization: Northwest Nexus, Inc. - Professional Internet Services
- Message-ID: <4f8mhm$lrn@news1.halcyon.com>
- References: <4f7ncl$998@infoserv.rug.ac.be>
- NNTP-Posting-Host: chinook.halcyon.com
-
- In article <4f7ncl$998@infoserv.rug.ac.be>,
- Ward De Backer <ward.debacker@rug.ac.be> wrote:
- >When I develop applications for Windows, I normally use Visual Basic for the
- >interface stuff and a DLL written with Visual C++ for the underlying
- >algorithms. I have always developed applications for Windows 3.11.
- >Lastly, I tested the new Visual C++ 4.0 compiler for Windows 95. I wrote a
- >32bit DLL with a simple testfunction in it. On the other side, I wrote a small
- >program in Visual Basic that calls this subroutine. The First major difference
- >I found was that the basic types of Visual Basic and Visual C++ are no longer
- >compatible (i.e. consistent) because an "Integer" in VB is 16 bit wide and a
- >standard int in VC++ is 32 bit wide in win95 (unless you declare it as int16).
- >But this was not the major problem. When I tried to test my function by
- >running my VB program, I couldn't get it to work by no means. Visual Basic
- >either didn't find my DLL function or issued a "bad calling convention"
- >message. Finally, I inspected my DLL executable with the dumpbin utility. To
- >my surprise, I saw a totally different way of naming exported functions.
- >Microsoft now uses so called "decorated names" for exported functions. This
- >means that a function name is appended with a "@" and the number of bytes on
- >the stack the function parameters occupy.
- >So far, so good. But the problem now is that Visual Basic doesn't recognise
- >these decorated names in your DLL. As a consequence, you have to declare all
- >the DLL functions with a decorated alias.
-
- I don't really use Visual Basic v. 4.0; but I have it on my machine. I read
- the README file in its directory, which explains how to build DLLs for it
- with Visual C++ v. 4.0; I built a small test case, and it worked. The file
- is called VB4DLL.TXT; it has a detalied description of the calling conven-
- tions. For example, it says you have to define NOMANGLE, and declare your
- exported functions as something like:
-
- NOMANGLE short CCONV PassInteger(short intgr, short far *pintgr)
- { ...
-
-
- Good luck!
-
-
-
-
- Juan Antonio Rodriguez-Sero; jars@halcyon.com;
- Lake Forest Park, WA 98155-2940, USA
- --------------------------------------------------------------------------
- More than any other time in history, mankind faces a crossroads. One path
- leads to despair and utter hopelessness. The other, to total extinction.
- Let us pray we have the wisdom to choose correctly.
- Woody Allen, "My speech to the graduates"
-